<!DOCTYPE html>
<html lang="ch" xmlns:th="http://www.thymeleaf.org" >
<head>
  <th:block th:include="inc :: header('菜单管理新增')" />
</head>
<body>
    <form id="dataForm" class="layui-form layui-form-pane" style="margin: 10px">
        <div class="layui-form-item">
            <label class="layui-form-label">菜单名称</label>
            <div class="layui-input-inline">
                <input type="text" name="menuName" class="layui-input" placeholder="请输入菜单/按钮名字" lay-verify="required"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="">父菜单名称</label>
            <div class="layui-input-inline">
                <input type="hidden" name="parentId" id="parentId">
                <input type="text" id="treeSelect" placeholder="模块" lay-filter="tree" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">菜单地址</label>
            <div class="layui-input-inline">
                <input type="text" name="menuUrl" class="layui-input" placeholder="菜单的地址"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">权限标识</label>
            <div class="layui-input-inline">
                <input type="text"  class="layui-input" name="authority" placeholder="按钮的标识"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">菜单类型</label>
            <div class="layui-input-block">
                <input type="radio" name="type" value="menu" title="菜单" />
                <input type="radio" name="type" value="btn" title="按钮" />
            </div>
        </div>
    </form>
    <script type="text/javascript">
        layui.config({
            base:'/js/module/',
        }).extend({
            treeSelect: "treeSelect/treeSelect"
        });
        layui.use(['form','treeSelect'],function () {
            var treeSelect =  layui.treeSelect;
            treeSelect.render({
                elem:'#treeSelect',
                data:'/muc/getMenuJson',
                type:'get',
                style:{
                    folder: {enable:false},
                    line:{enable: true}
                },
                search:true,//开启搜索
                click:function (data) {
                    var parentId = data.current.id;
                    $('#parentId').val(parentId);
                }
            });
        });
    </script>

</body>
</html>